<template>
  <div class="form-list-3">
    <div class="form-title-box">
      <div class="form-title-left" :style="{ height: formParameter.formTitleHeight, width: formParameter.leftFormTitleWidth }">
        <div class="form-title-left-item" :style="{ width: item.width }" v-for="item in formParameter.leftForm" :key="item.title">{{ item.title }}</div>
      </div>
      <div class="form-title-right" :style="{ height: formParameter.formTitleHeight, width: formParameter.rightFormTitleWidth }">
        <div class="form-title-right-item" :style="{ width: item.width }" v-for="item in formParameter.rightForm" :key="item.title">{{ item.title }}</div>
      </div>
    </div>
    <div class="form-list-box" :style="{ height: `calc(100% - ${formParameter.formTitleHeight})` }">
      <div class="form-list-left" :style="{ width: formParameter.leftFormTitleWidth }">
        <div class="form-list-left-line" :style="{ width: item.width }" v-for="item in formParameter.leftForm" :key="item.title">{{ data_list[item.title] }}</div>
      </div>
      <div class="form-list-right" :style="{ width: formParameter.rightFormTitleWidth }">
        <div class="form-list-right-hang" v-for="itemHang in data_list.data_list" :key="itemHang.title">
          <div class="form-list-right-line" :style="{ color: itemHang[item.stateShow] ? 'red' : '#000', width: item.width }" v-for="item in formParameter.rightForm">{{ itemHang[item.title] }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  // 组件名称
  name: 'formList-3',
  // 组件参数 接收来自父组件的数据
  props: {
    formParameter: {
      type: Object,
      default: () => {
        return {};
      },
    },
    data_list: {
      type: [Object, Array],
      default: () => {
        return {};
      },
    },
  },
  // 局部注册的组件
  components: {},
  // 组件状态值
  data() {
    return {};
  },
  // 计算属性
  computed: {},
  // 侦听器
  watch: {},
  // 组件方法
  methods: {},
  created() {},
  mounted() {},
};
</script>

<style lang="less" scoped>
.form-list-3 {
  --borderColor: #000;
  height: 100%;
  font-size: 1.3rem;
  .form-title-box {
    display: flex;
    color: #fff;
    background: #4874cb;
    border: 1px solid var(--borderColor);
    .form-title-left {
      display: flex;
      .form-title-left-item {
        padding: 0 5px;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        border-right: 1px solid var(--borderColor);
      }
    }
    .form-title-right {
      display: flex;
      .form-title-right-item {
        padding: 0 5px;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        border-right: 1px solid var(--borderColor);
        &:last-child {
          border-right: none;
        }
      }
    }
  }
  .form-list-box {
    display: flex;
    border: 1px solid var(--borderColor);
    .form-list-left {
      display: flex;
      justify-content: center;
      align-items: center;
      .form-list-left-line {
        padding: 0 5px;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        height: 100%;
        border-right: 1px solid var(--borderColor);
      }
    }
    .form-list-right {
      display: flex;
      flex-direction: column;
      .form-list-right-hang {
        flex: 1;
        display: flex;
        border-bottom: 1px solid var(--borderColor);
        &:last-child {
          border-bottom: none;
        }
        .form-list-right-line {
          display: flex;
          justify-content: center;
          align-items: center;
          text-align: center;
          border-right: 1px solid var(--borderColor);
          &:last-child {
            border-right: none;
          }
        }
      }
    }
  }
}
</style>
